import React, { Component } from 'react';
import { Switch, Route } from 'react-router-dom';
import { connect } from 'react-redux';
import AsyncLoad from '../components/AsyncLoad';
import { object } from 'prop-types';
export const AsyncLogin = AsyncLoad({
  //登录
  loader: () => import('../containers/Login.js')
});
export const AsyncRegister = AsyncLoad({
  //登录
  loader: () => import('../containers/Register.js')
});
export class Auth extends Component {
  render() {
    const height = window.innerHeight;
    return (
      <div className="authBg" style={{ height: height }}>
        <Switch>
          <Route path="/auth/login" component={AsyncLogin} />
          <Route path="/auth/register" component={AsyncRegister} />
        </Switch>
      </div>
    );
  }
}
const contextTypes = {
  router: object.isRequired
};
Auth.contextTypes = contextTypes;
const mapStateToProps = state => ({});
const mapDispatchToProps = {};

export default connect(
  mapStateToProps,
  mapDispatchToProps
)(Auth);
